<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id ="app">
        姓：<input type="text" v-model="xName"><br>
        名：<input type="text" v-model="mName"><br>
        姓名：<span>{{fullName()}}</span>
    </div>

    <script>
        //创建Vue实例,得到 ViewModel
        const vm = new Vue({
            el: '#app',
            data: {
                xName:'张',
                mName:'三'
            },
            methods: {
                fullName() {
                    // this是vm对象
                    return this.xName + '_' + this.mName
                }
            }
        });
    </script>
</body>
</html>